package dongshi.daddy.service;

public class MyHystrixServiceImpl implements MyHystrixService {
    static int i = 0;
    @Override
    public String sayHi(String word) {
        /*
        while (true) {
            System.out.println("处理 【 " + word + " 】 中");
            try {
                Thread.sleep(100);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }*/
        int j = 0;
        while (j < 100 || (j > 200 && j < 300)) {
            j = i++;
            System.out.println("异常处理 【 " + word + " 】 中");
            try {
                Thread.sleep(100);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
        System.out.println("正常处理 【 " + word + " 】 中");
        return "real hystrix say hi: " + word;
//        return "real hystrix say hi: " + word;
//        throw new RpcException("处理 【 " + word + " 】 发生异常了");
    }
}
